#include <iostream>
#include <type_traits>

template <typename T, typename U = typename T::value_type>
void f(U)
{
    std::cout << "primary template\n";
}

template <typename T>
void f(...)
{
    std::cout << "fallback\n";
}

struct WithValue {
    using value_type = int;
};
struct WithoutValue { };

int main()
{
    f<WithValue>(1); // 显式给出 T=WithValue
    f<WithoutValue>(1); // 显式给出 T=WithoutValue
}
